﻿@model MessageModel
@{
    ViewBag.Title = "Ifnot";
}

<h2>Ifnot</h2>

<p>The ifnot binding is exactly the same as the if binding, except that it inverts the result of whatever expression you pass to it. For more details, see documentation for the if binding.</p>
<p><a href="http://knockoutjs.com/documentation/ifnot-binding.html" target="_blank">http://knockoutjs.com/documentation/ifnot-binding.html</a></p>

<p>Click on the checkbox to see example of the "Ifnot" function in action</p>

@Html.VisiTogglerFromPartial(CodeSamplePartials.IFNOT_VIEW_MODEL, Html.CreateVisiToggler("show the samples view model C# source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))

<label>
    <input type="checkbox" @Html.KoAttrChecked(m => m.displayMessage) />
    Display message</label>

<h3>Sample #1</h3>

<p>Using data-bind attribute</p>

<div @Html.KoAttrIfnot(m => m.displayMessage)>Here is a <b>NOT checked</b> message. Astonishing.</div>

@Html.VisiTogglerFromPartial(CodeSamplePartials.IFNOT1, Html.CreateVisiToggler("show the sample source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))

<h3>Sample #2</h3>

<p>Containerless control flow syntax</p>

@using (Html.KoIfnot(m => !m.displayMessage))
{
    <div>Here is a <b>checked</b> message. Astonishing.</div>
}

@Html.VisiTogglerFromPartial(CodeSamplePartials.IFNOT2, Html.CreateVisiToggler("show the sample source code ", htmlAttributes: new { @class = "onright" }, options: VisiOptions.HiddenByDefault))


<p>&nbsp;</p>
<p>Next &gt; @Html.ActionLink("With", "With", "Examples")</p>


@Model.ApplyBindingsScript()